﻿using System;
using System.Text;
namespace MyFastDataSourceBind
{
    // 编制 袁永福

    /// <summary>
    /// 生成数据源字段初始化值事件参数
    /// </summary>
    public class GenerateNewFieldValueEventArgs : System.EventArgs
    {
        /// <summary>
        /// 初始化对象
        /// </summary>
        /// <param name="ds">数据源对象</param>
        /// <param name="field">字段名</param>
        /// <param name="defaultValue">默认值</param>
        /// <param name="valueType">字段数据类型</param>
        public GenerateNewFieldValueEventArgs(
            XDataSource ds,
            string field,
            object defaultValue,
            Type valueType)
        {
            myDataSource = ds;
            strDataSourceName = ds.Name;
            strDataFieldName = field;
            objDefaultValue = DefaultValue;
            myValueType = valueType;
            objNewValue = objDefaultValue;
        }
        private XDataSource myDataSource = null;
        /// <summary>
        /// 数据源对象
        /// </summary>
        public XDataSource DataSource
        {
            get
            {
                return myDataSource;
            }
        }

        private string strDataSourceName = null;
        /// <summary>
        /// 数据源名称
        /// </summary>
        public string DataSourceName
        {
            get
            {
                return strDataSourceName;
            }
        }

        private string strDataFieldName = null;
        /// <summary>
        /// 字段名
        /// </summary>
        public string DataFieldName
        {
            get
            {
                return strDataFieldName;
            }
        }

        private Type myValueType = null;
        /// <summary>
        /// 字段数据类型
        /// </summary>
        public Type ValueType
        {
            get
            {
                return myValueType;
            }
        }

        private object objDefaultValue = null;
        /// <summary>
        /// 默认值
        /// </summary>
        public object DefaultValue
        {
            get
            {
                return objDefaultValue;
            }
        }

        private object objNewValue = null;
        /// <summary>
        /// 获得或设置新的字段值
        /// </summary>
        public object NewValue
        {
            get
            {
                return objNewValue;
            }
            set
            {
                objNewValue = value;
            }
        }

        private bool bolCancel = false;
        /// <summary>
        /// 获得或设置是否取消当前操作
        /// </summary>
        public bool Cancel
        {
            get
            {
                return bolCancel;
            }
            set
            {
                bolCancel = value;
            }
        }
    }
}
